package com.driving.single.frontend.friendlink.service.impl;

import com.driving.single.common.domain.TbFriendlink;
import com.driving.single.common.entity.DrivingResult;
import com.driving.single.common.mapper.TbFriendlinkMapper;
import com.driving.single.frontend.friendlink.service.FrontendFriendlinkService;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;
import java.util.List;

/**
 * 友情链接  业务层接口实现类
 *
 * @author xsfno1
 * @version v1.0.0
 * @date 2020/2/21 19:53
 * @see com.driving.single.frontend.friendlink.service.impl
 **/
@Service
public class FrontendFriendlinkServiceImpl implements FrontendFriendlinkService {
    @Resource
    private TbFriendlinkMapper tbFriendlinkMapper;

    /**
     * 获取友情链接数据
     *
     * @return {@link DrivingResult}
     */
    @Override
    public DrivingResult getFriendlinkService() {
        Example example = new Example(TbFriendlink.class);
        // 只显示actived=1的友情链接数据 , actived:是否显示
        example.createCriteria().andEqualTo("actived", 1);
        List<TbFriendlink> list = this.tbFriendlinkMapper.selectByExample(example);
        return DrivingResult.ok(list);
    }
}
